package gang.org.springframework.framework.util;

import gang.org.springframework.framework.io.GangResource;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * @author gang.chen
 * @description
 * @Date 2021/7/30 13:19
 */
public abstract class GangPropertiesLoaderUtils {
    //TODO
    public static Properties loadProperties(GangResource resource) {
        Properties props = new Properties();
        fillProperties(props,resource);
        return props;
    }

    //TODO
    private static void fillProperties(Properties props, GangResource resource) {
        try {
            InputStream is = resource.getInputStream();
            props.load(is);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
